package demo;
import java.time.LocalDate;
import java.util.HashSet;
import java.util.Scanner;

/**
 * @Author liangzai
 * @Description:
 */

public class Main {
    //子串分值和(待完成)
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        HashSet<Character> set = new HashSet<>();

    }

    //握手问题
    public static void main2(String[] args) {
        int sum = 0;
        for (int i = 49; i >= 7; i--) {
            sum += i;
        }
        System.out.println(sum);
    }

    //小球反弹
    public static void main3(String[] args) {
        //double val = (15f*466666f)/(17f*343720f);
        int x = 0;
        int y = 0;
        //System.out.println(val);
        for (float i = 1; i<=100000; i++) {
            for (float j = 1; j < i; j++) {
                if(j*343720f/i/233333f == 15f/17f) {
                    y = (int)j;
                    x = (int)i;
                }
            }
        }
        //System.out.println(val);
        System.out.println(x+" "+y);

//		long x=343720;
//        long y=233333;
//        long dx=15;
//        long dy=17;
//        long t=1;
//        while(true){
//            if((dx*t)%x == 0 && (dy*t)%y == 0){
//                break;
//            }
//            t++;
//        }
//        long sx = dx*t;
//        long sy = dy*t;
//        System.out.println(t*15/343720+" "+t*17/233333);
//        System.out.println();
//        if(1059f*343720f/233333f/1768f == 15f/17f) {
//        	System.out.println(true);
//        }
    }


    //小球反弹
    public static void main5(String[] args) {
        long x = 233333;
        long y = 343720;
        long t = 1;
        long dx = 15;
        long dy = 17;
        while(true) {
            if((dx*t)%y==0 && (dy*t)%x == 0) {
                break;
            }
            t++;
        }
        long xx = t*dx;
        long yy = t*dy;
        System.out.println(t);
        System.out.printf("%.2f",2*Math.sqrt(xx*xx+yy*yy));
        //System.out.println(1100325199.77);
    }

    public static void main4(String[] args) {
        long x=343720;
        long y=233333;
        long dx=15;
        long dy=17;
        long t=1;
        while(true){
            if((dx*t)%x == 0 && (dy*t)%y == 0){
                break;
            }
            t++;
        }
        long sx = dx*t;
        long sy = dy*t;
        System.out.printf("%.2f",2*Math.sqrt(sx*sx + sy*sy));
    }

    //艺术与篮球
    public static void main6(String[] args) {
        int count = 0;
        int[] month = {0,31,28,31,30,31,30,31,31,30,31,30,31};
        int[] val = {13,1,2,3,5,4,4,2,2,2};
        for (int i = 2000; i <= 2024; i++) {
            if((i%4==0 && i%100!=0) || i%400==0) {
                month[2] = 29;
            }else {
                month[2] = 28;
            }
            for (int j = 1; j <= 12; j++) {
                if(i==2024 && j==5) {
                    break;
                }

                String dateString = j<10 ? i+"0"+j : i+""+j;
                for (int k = 1; k <= month[j]; k++) {
                    String dateString2 = k<10 ? dateString+"0"+k : dateString+""+k;
                    System.out.println(dateString2);
                    int val2 = 0;
                    for (int m = 0; m < 8; m++) {
                        val2 += val[dateString2.charAt(m) - '0'];
                    }
                    if(val2>50) {
                        count++;
                    }
                    if(i==2024 && j==4 && k==13) {
                        break;
                    }
                }
            }
        }
        System.out.println(count);
        System.out.println(3228);
    }

    //幸运数
    public static void main7(String[] args) {
        long count = 0;
        for (int i = 1; i <= 99999999; i++) {
            if(fun1(i)) {
                count++;
            }
        }
        System.out.println(count);
        System.out.println(4430091);
    }

    private static boolean fun1(int num) {
        String string = String.valueOf(num);
        if(string.length()%2==0) {
            int index = string.length()/2-1;
            int val1 = 0;
            int val2 = 0;
            for (int i = 0; i <= index; i++) {
                val1 += string.charAt(i);
            }
            for (int i = index+1; i < string.length(); i++) {
                val2 += string.charAt(i);
            }
            //System.out.println(string);
            if(val1 == val2) {
                System.out.println(string);
                return true;
            }
        }
        return false;
    }

    //平方差
    public static void main8(String[] args) {
        int count = 0;
        HashSet<Integer> set = new HashSet<>();
        for (int i = 1011; i >= 1; i--) {
            for (int j = i-1; j >= 0 ; j--) {
                int val = i*i - j*j;
                if(val>=1 && val<=2021) {
                    set.add(val);
                    System.out.println(i*i+" "+j*j+" "+ val);
                }
            }
        }
        System.out.println(set.size());
        System.out.println(1516);
    }

    //求和
    public static void main9(String[] args) {
        int sum = 0;
        for (int i = 1; i <= 2019; i++) {
            if(fun2(i)) {
                System.out.println(i);
                sum += i;
            }
        }
        System.out.println(sum);
        System.out.println(1478);
    }

    private static boolean fun2(int num) {
        int val = num;
        while(val>0) {
            int n = val%10;
            if(n==2 || n==0 || n==1 || n==9) {
                return true;
            }
            val /= 10;
        }
        return false;
    }

    //3个1
    public static void main10(String[] args) {
        int count = 0;
        for (int i = 1; ; i++) {
            int val = i;
            int key = 0;
            while(val>0) {
                if(val%2==1) {
                    key++;
                }
                val >>= 1;
            }
            if(key==3) {
                System.out.println(i);
                count++;
            }
            if(count==23) {
                System.out.println(i);
                break;
            }
        }
    }

    //美丽的2024
    public static void main11(String[] args) {
        int val = 2024;
        int count = 0;
        while(val>0) {
            if(val%2 == 1) {
                count++;
            }
            val>>=1;
        }
        System.out.println(count);
    }

    //特殊的数
    public static void main12(String[] args) {
        for (int i = 10; ; i++) {
            int val = i;
            int sum = 0;
            int count = 0;
            while(val>0) {
                int num = val%10;
                sum += Math.pow(16, count)*num;
                val /= 10;
                count++;
            }
            if(sum%i==0) {
                System.out.println(i);
                break;
            }
        }
    }

    //跑步计划
    public static void main13(String[] args) {
        LocalDate startdate = LocalDate.of(2023, 1, 1);
        LocalDate enddateDate = LocalDate.of(2023, 12, 31);
        int sum = 0;
        int count = 0;
        while(!startdate.isAfter(enddateDate)) {
            if(startdate.toString().contains("1") || count==1) {
                sum += 5;
                System.out.println(startdate.toString());
            }else {
                sum++;
            }
            startdate = startdate.plusDays(1);
            count = (count+1)%7;
        }
        System.out.println(sum);
        System.out.println(1328);
    }


//	public static void main(String[] args) {
//        Scanner scan = new Scanner(System.in);
//        int[] arr = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
//        int day = 0;
//        int week = 7;
//        for (int m = 0; m < 12; m++) {
//            for (int d = 1; d <= arr[m]; d++) {
//                if (week > 7) {
//                    week = 1;
//                }
//                if ((d >= 10 && d <= 19) || d == 1 || d == 21 || d == 31 || week == 1 || m == 0 || m >= 9) {
//                    day++;
//                }
//                week++;
//            }
//        }
//        System.out.print(day * 5 + (365 - day));
//    }

    //异或和之和
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int []a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        long result = 0;
        for (int i = 0; i < n; i++) {
            long sum = 0;
            for (int j = i; j < n; j++) {
                sum ^= a[j];
                result+=sum;
            }
        }
        System.out.println(result);
    }
}

